cmake_minimum_required(VERSION 2.8)
project(wpmz)

# 查找 Java
find_package(JNI REQUIRED)

# 包含 JNI 头文件
include_directories(${JNI_INCLUDE_DIRS})

# 创建主库
add_library(Wpmz SHARED wpml.cpp Wpmz.cpp)
target_include_directories(Wpmz PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if(WIN32)
    target_compile_definitions(Wpmz PRIVATE BUILDING_DLL)
endif()

# 创建 JNI 库
add_library(WpmzJni SHARED com_dji_wpmz_WpmzJni.cpp)
target_include_directories(WpmzJni PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${JNI_INCLUDE_DIRS})
target_link_libraries(WpmzJni Wpmz)

# 添加可执行文件
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} Wpmz)

add_subdirectory(java)